return St.TextureCache.get_default().load_recent_thumbnail(size, this.recentInfo);
},
- launch : function() {
- Shell.DocSystem.get_default().open(this.recentInfo);
+ launch : function(workspaceIndex) {
+ Shell.DocSystem.get_default().open(this.recentInfo, workspaceIndex);
},
matchTerms: function(terms) {
'icon': app.create_icon_texture(Search.RESULT_ICON_SIZE)};
},
- activateResult: function(id) {
+ activateResult: function(id, params) {
+ params = Params.parse(params, { workspace: null,
+ timestamp: null });
+
let app = this._appSys.get_app(id);
- app.activate();
+ app.activate(params.workspace ? params.workspace.index() : -1);
},
- dragActivateResult: function(id) {
+ dragActivateResult: function(id, params) {
+ params = Params.parse(params, { workspace: null,
+ timestamp: null });
+
let app = this._appSys.get_app(id);
- app.open_new_window();
+ app.open_new_window(params.workspace ? params.workspace.get_index() : -1);
}
};
let launchWorkspace = global.screen.get_workspace_by_index(global.screen.n_workspaces - 1);
launchWorkspace.activate(global.get_current_time());
this.emit('launching');
- this.app.open_new_window();
+ this.app.open_new_window(-1);
Main.overview.hide();
}
return false;
if (modifiers & Clutter.ModifierType.CONTROL_MASK
&& this.app.state == Shell.AppState.RUNNING) {
- this.app.open_new_window();
+ this.app.open_new_window(-1);
} else {
- this.app.activate();
+ this.app.activate(-1);
}
Main.overview.hide();
},
return this._menu.menuEventFilter(event);
},
- shellWorkspaceLaunch : function() {
- this.app.open_new_window();
+ shellWorkspaceLaunch : function(params) {
+ params = Params.parse(params, { workspace: null,
+ timestamp: null });
+
+ this.app.open_new_window(params.workspace ? params.workspace.index() : -1);
},
getDragActor: function() {
let metaWindow = child._window;
this.emit('activate-window', metaWindow);
} else if (child == this._newWindowMenuItem) {
- this._source.app.open_new_window();
+ this._source.app.open_new_window(-1);
this.emit('activate-window', null);
} else if (child == this._toggleFavoriteMenuItem) {
let favs = AppFavorites.getAppFavorites();
const _ = Gettext.gettext;
const DocInfo = imports.misc.docInfo;
+const Params = imports.misc.params;
const Search = imports.ui.search;
'icon': docInfo.createIcon(Search.RESULT_ICON_SIZE)};
},
- activateResult: function(id) {
+ activateResult: function(id, params) {
+ params = Params.parse(params, { workspace: null,
+ timestamp: null });
+
let docInfo = this._docManager.lookupByUri(id);
- docInfo.launch();
+ docInfo.launch(params.workspace ? params.workspace.index() : -1);
},
getInitialResultSet: function(terms) {
_onClicked: function() {
this.emit('activate');
- this._app.activate();
+ this._app.activate(-1);
}
};
Signals.addSignalMethods(ListItem.prototype);
const DND = imports.ui.dnd;
const Main = imports.ui.main;
+const Params = imports.misc.params;
const Search = imports.ui.search;
const Util = imports.misc.util;
}
};
+// Helper function to translate launch parameters into a GAppLaunchContext
+function _makeLaunchContext(params)
+{
+ params = Params.parse(params, { workspace: null,
+ timestamp: null });
+
+ let launchContext = global.create_app_launch_context();
+ if (params.workspace != null)
+ launchContext.set_desktop(params.workspace.index());
+ if (params.timestamp != null)
+ launchContext.set_timestamp(params.timestamp);
+
+ return launchContext;
+}
+
function PlaceDeviceInfo(mount) {
this._init(mount);
}
return St.TextureCache.get_default().load_gicon(null, icon, size);
},
- launch: function() {
+ launch: function(param) {
Gio.app_info_launch_default_for_uri(this._mount.get_root().get_uri(),
- global.create_app_launch_context());
+ _makeLaunchContex(params));
},
isRemovable: function() {
}
};
-
function PlacesManager() {
this._init();
}
function(size) {
return St.TextureCache.get_default().load_gicon(null, homeIcon, size);
},
- function() {
- Gio.app_info_launch_default_for_uri(homeUri, global.create_app_launch_context());
+ function(params) {
+ Gio.app_info_launch_default_for_uri(homeUri, _makeLaunchContext(params));
});
let desktopPath = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DESKTOP);
function(size) {
return St.TextureCache.get_default().load_gicon(null, desktopIcon, size);
},
- function() {
- Gio.app_info_launch_default_for_uri(desktopUri, global.create_app_launch_context());
+ function(params) {
+ Gio.app_info_launch_default_for_uri(desktopUri, _makeLaunchContext(params));
});
this._connect = new PlaceInfo('special:connect', _("Connect to..."),
icon_type: St.IconType.FULLCOLOR,
icon_size: size });
},
- function () {
+ function (params) {
+ // BUG: nautilus-connect-server doesn't have a desktop file, so we can't
+ // launch it with the workspace from params. It's probably pretty rare
+ // and odd to drag this place onto a workspace in any case
+
Util.spawn(['nautilus-connect-server']);
});
function(size) {
return networkApp.create_icon_texture(size);
},
- function () {
- networkApp.launch();
+ function (params) {
+ params = Params.parse(params, { workspace: null,
+ timestamp: 0 });
+
+ networkApp.launch_full(params.timestamp, [],
+ params.workspace ? params.workspace.index() : -1);
});
}
function(size) {
return St.TextureCache.get_default().load_gicon(null, icon, size);
},
- function() {
- Gio.app_info_launch_default_for_uri(bookmark, global.create_app_launch_context());
+ function(params) {
+ Gio.app_info_launch_default_for_uri(bookmark, _makeLaunchContext(params));
});
this._bookmarks.push(item);
}
'icon': placeInfo.iconFactory(Search.RESULT_ICON_SIZE) };
},
- activateResult: function(id) {
+ activateResult: function(id, params) {
let placeInfo = Main.placesManager.lookupPlaceById(id);
- placeInfo.launch();
+ placeInfo.launch(params);
},
_compareResultMeta: function (idA, idB) {
return lang != null;
},
- activateResult: function(id) {
+ activateResult: function(id, params) {
let searchTerms = this._terms.join(' ');
let url = this._providers[id].url.replace('{searchTerms}', encodeURIComponent(searchTerms));
return new Clutter.Clone({ source: this.metaInfo['icon'] });
},
- shellWorkspaceLaunch: function() {
+ shellWorkspaceLaunch: function(params) {
if (this.provider.dragActivateResult)
- this.provider.dragActivateResult(this.metaInfo.id);
+ this.provider.dragActivateResult(this.metaInfo.id, params);
else
- this.provider.activateResult(this.metaInfo.id);
+ this.provider.activateResult(this.metaInfo.id, params);
}
};
time);
return true;
} else if (source.shellWorkspaceLaunch) {
- this.metaWorkspace.activate(time);
- source.shellWorkspaceLaunch();
+ source.shellWorkspaceLaunch({ workspace: this.metaWorkspace,
+ timestamp: time });
return true;
}
time);
return true;
} else if (source.shellWorkspaceLaunch) {
- this.metaWorkspace.activate(time);
- source.shellWorkspaceLaunch();
+ source.shellWorkspaceLaunch({ workspace: this.metaWorkspace,
+ timestamp: time });
return true;
}
/**
* shell_app_activate:
* @app: a #ShellApp
+ * @workspace: launch on this workspace, or -1 for default. Ignored if
+ * activating an existing window
*
* Perform an appropriate default action for operating on this application,
* dependent on its current state. For example, if the application is not
* recently used transient for that window).
*/
void
-shell_app_activate (ShellApp *app)
+shell_app_activate (ShellApp *app,
+ int workspace)
{
switch (app->state)
{
case SHELL_APP_STATE_STOPPED:
/* TODO sensibly handle this error */
- shell_app_info_launch (app->info, NULL);
+ shell_app_info_launch_full (app->info,
+ 0,
+ NULL,
+ workspace,
+ NULL,
+ NULL);
break;
case SHELL_APP_STATE_STARTING:
break;
/**
* shell_app_open_new_window:
* @app: a #ShellApp
+ * @workspace: open on this workspace, or -1 for default
*
* Request that the application create a new window.
*/
void
-shell_app_open_new_window (ShellApp *app)
+shell_app_open_new_window (ShellApp *app,
+ int workspace)
{
/* Here we just always launch the application again, even if we know
* it was already running. For most applications this
* as say Pidgin. Ideally, we have the application express to us
* that it supports an explicit new-window action.
*/
- shell_app_info_launch (app->info, NULL);
+ shell_app_info_launch_full (app->info,
+ 0,
+ NULL,
+ workspace,
+ NULL,
+ NULL);
}
/**
void shell_app_activate_window (ShellApp *app, MetaWindow *window, guint32 timestamp);
-void shell_app_activate (ShellApp *app);
+void shell_app_activate (ShellApp *app,
+ int workspace);
-void shell_app_open_new_window (ShellApp *app);
+void shell_app_open_new_window (ShellApp *app,
+ int workspace);
ShellAppState shell_app_get_state (ShellApp *app);
* shell_doc_system_open:
* @system: A #ShellDocSystem
* @info: A #GtkRecentInfo
+ * @workspace: Open on this workspace, or -1 for default
*
* Launch the default application associated with the mime type of
* @info, using its uri.
*/
void
shell_doc_system_open (ShellDocSystem *system,
- GtkRecentInfo *info)
+ GtkRecentInfo *info,
+ int workspace)
{
GFile *file;
GAppInfo *app_info;
gboolean needs_uri;
+ GAppLaunchContext *context;
+
+ context = shell_global_create_app_launch_context (shell_global_get ());
+ if (workspace != -1)
+ gdk_app_launch_context_set_desktop ((GdkAppLaunchContext *)context, workspace);
file = g_file_new_for_uri (gtk_recent_info_get_uri (info));
needs_uri = g_file_get_path (file) == NULL;
{
GList *uris;
uris = g_list_prepend (NULL, (gpointer)gtk_recent_info_get_uri (info));
- g_app_info_launch_uris (app_info, uris, shell_global_create_app_launch_context (shell_global_get ()), NULL);
+ g_app_info_launch_uris (app_info, uris, context, NULL);
g_list_free (uris);
}
else
if (gtk_recent_info_get_application_info (info, app_name, &app_exec, &count, &time))
{
GRegex *regex;
- GAppLaunchContext *context;
/* TODO: Change this once better support for creating
GAppInfo is added to GtkRecentInfo, as right now
despite passing the app launch context, no startup
notification occurs.
*/
- context = shell_global_create_app_launch_context (shell_global_get ());
g_app_info_launch (app_info, NULL, context, NULL);
- g_object_unref (context);
}
g_free (app_name);
}
+
+ g_object_unref (context);
}
static void
guint n_items);
void shell_doc_system_open (ShellDocSystem *system,
- GtkRecentInfo *info);
+ GtkRecentInfo *info,
+ int workspace);
#endif /* __SHELL_DOC_SYSTEM_H__ */